package com.hzw.saas.service.old.hub.enums;

import java.util.Objects;

/**
 * 文件分片状态
 *
 * @author zzl
 * @since 02/24/2021
 */
public enum LocChunkStatusEnum {

    MERGED(1, "已合并"), // 分片从文件中获取
    MERGING(2, "待合并"),  // 分片单独存在
    ;
    private final Integer code;
    private final String text;

    LocChunkStatusEnum(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public Integer code() {
        return code;
    }

    public String text() {
        return text;
    }

    public static String text(Integer code) {
        for (LocChunkStatusEnum value : LocChunkStatusEnum.values()) {
            if (Objects.equals(value.code, code)) return value.text;
        }
        return null;
    }

    public static LocChunkStatusEnum instance(Integer code) {
        for (LocChunkStatusEnum value : LocChunkStatusEnum.values()) {
            if (Objects.equals(value.code, code)) return value;
        }
        return null;
    }

}
